<!DOCTYPE html>
<html>
<head>
    <!--需要改-->
    <base href="http://localhost/curriculumDesign/cilentservicer/">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="Content-Language" content="zh-CN">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CS - cilent</title>
    <!-- <link rel="stylesheet" href="css/bootstrap.min.css" type="text/css"> -->
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/bootstrap-theme.min.css"
          rel="stylesheet">
    <script src="js/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/vue.js"></script>
    <script src="js/vue-resource.js"></script>

</head>
<body>
<div style="margin-top: 30px;"></div>
<div class="container">
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">测试区 - 客户的客户端！！！</h3>
        </div>
    </div>
    <div class="panel-body">
        <div id="login">
            <input v-model="loginUid" placeholder="loginUid">
            <button class="btn btn-default" @click="login()">Submit</button>
            <label>当前User：{{uid}}</label>
        </div>

        <script>
            var vm = new Vue({
                el: '#login',
                data: {
                    loginUid: "10010",
                    uid: null
                },
                methods: {
                    login: function () {
                        this.$http.get("login", {params: {uid: this.loginUid}}).then(function (value) {
                            alert("ok")
                        })
                    },
                    getUid:function () {
                        this.$http.get("uid").then(function (value) { this.uid = value.body })
                    }
                }
            })
            setInterval(vm.getUid, 2000);
        </script>
    </div>
</div>
<!--信息区-->
<div class="container">
    <div id="servicedListTable" class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">客户中心 - 所有服务记录</h3>
        </div>
        <div class="panel-body">
            <div class="table-responsive" style="margin: 6px 0 0 0;">
                <!-- 属性行 -->
                <table class="table table-hover table-bordered">
                    <thead>
                    <tr>
                        <th>
                            <div class="th-inner">客服ID</div>
                        </th>
                        <th>
                            <div class="th-inner">开始时间</div>
                        </th>
                        <th>
                            <div class="th-inner">结束时间</div>
                        </th>
                        <th>
                            <div class="th-inner ">评分</div>
                        </th>
                    </tr>
                    </thead>

                    <tbody>
                    <div>
                        <tr v-for="serviced in servicedList" :key="serviced.uid">
                            <td>{{serviced.suid}}</td>
                            <td>{{new Date(serviced.beginTime).getFullYear() + '-' + (new
                                Date(serviced.beginTime).getMonth() + 1) + '-' + new
                                Date(serviced.beginTime).getDate()}}
                            </td>
                            <td>{{new Date(serviced.endTime).getFullYear() + '-' + (new
                                Date(serviced.endTime).getMonth() + 1) + '-' + new Date(serviced.endTime).getDate()}}
                            </td>
                            <td>{{serviced.score}}</td>
                        </tr>
                    </div>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
<!--操作区-->
<div id="funcBox" class="container">
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">Panel title</h3>
        </div>
        <div class="panel-body">
            <button @click="reqService()" type="button" class="btn btn-info">请求连接客服</button>
            <button @click="cutChat()" type="button" class="btn btn-info">断开连接</button>
            <button @click="endChat()" type="button" class="btn btn-info">评分</button>
        </div>
    </div>
</div>
<!--特定区-->
<div class="container">
    <!--msgListTable-->
    <div id="msgListTable" class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">客户中心 - 聊天记录</h3>
        </div>
        <div class="panel-body">
            <!--发送聊天信息的窗口-->
            <div>
                <input v-model="sendMsg.value" placeholder="value">
                <button class="btn btn-default" @click="fsendMsg()">sendMsg</button>
            </div>
            <!--聊天记录窗口-->
            <div class="table-responsive" style="margin: 6px 0 0 0;">
                <!-- 属性行 -->
                <table class="table table-hover table-bordered">
                    <thead>
                    <tr>
                        <th>
                            <div class="th-inner">value</div>
                        </th>
                        <th>
                            <div class="th-inner">time</div>
                        </th>
                        <th>
                            <div class="th-inner">type</div>
                        </th>
                    </tr>
                    </thead>

                    <tbody>
                    <div>
                        <tr v-for="msg in msgList" :key="msg.time">
                            <td>{{msg.value}}</td>
                            <td>{{new Date(msg.time)}}</td>
                            <td>{{msg.type}}</td>
                        </tr>
                    </div>
                    </tbody>
                </table>
            </div>
        </div>
    </div>

</div>
<script src="js/cilent.js"></script>
</body>
</html>